home *** CD-ROM | disk | FTP | other *** search
- > > > Well, about dynamic banks...
- > > > I thought on them for some time and cannot Paul add a
- > > > Banklenghtadd(bytes) command?
- > > > I don't know, call it Elbnkadd(number,bytes)
- > > > or better Elbnkadd(number of the bank, position, bytes).
- > > > This will solve many problems.
-
- It might do, but it would only reserve a new longer bank, and copy old one over
- it, then delete the original and call bankswap to change the numbers (Which was
- the original solution to this problem). As this is
-
- a) Only a few lines of code
-
- b) Rarely Executed (I.E. It wouldn't be in a fast loop)
-
- c) Crap coding anyway is it uses at least double the memory of the bank
-
- I don't think it is worth adding to easylife. A much better solution is to use
- some form a dynamic memory allocation - I.E. instead of making the
- bank larger, reserve another bank for the extra data.
-
- In practice its easier to reserve memory for each structure seperately,
- which is what both easylife & makelib do.
-
-
- > > > Poking directly with the bank's lenght is quite dangerous as you could
- > > > overlap memory used for something else.
-
- Quite dangerous is an understatement. DON'T DO THIS.
-
-
-
- > > > And copying the bank is quite slow if you have a large bank.
- > > >
- And memory consuming as it requires a large amount of unfragmented
- memory.
-
- > > > Any ideas or comment?
- > > >
- > > How about using MakeLib extension (1.6kb) which has some nice mem.
- > > allocation + list handling routines ??
- > >
- > > Like:
- > >
- > > BUFFER = Ma Malloc (1024,MEM_PUBLIC)
- > > if BUFFER
- > > <Do what ever you want to do for BUFFER (1024 bytes)>
- > > Ma Free (BUFFER) : Rem Free BUFFER
- > > End If
- > >
- > > You can also forget Ma Free or can use Ma Free All (Which is
- > > automatically executed when quitting AMOSPro or compiled AMOS
- > > program)
- > >
- > > This is something I call _dynamic_ memory allocationg AMOS banks(tm)
- > > sucks.
-
- I don't call this dynamic. It is only as dynamic as:
-
- trap Reserve as work bnkno,1024
- if not errtrap
- 'Do whatever
- Erase bnkno
- endif
-
- Makelib's linked list structure is dynamic, but is restrictive in that it is
- only
- a list - you can't build arbitary structures, and accessing the elements of
- the list still involves poking & peeking the memory of the list. Whilst this is
- faster than easylife's structures representation it does mean that you have
- no type-checking on the list elements, and if you change the format of the
- data poked/peeked you have to rewrite your code, not to mention the
- readability stinks.
-
- However the linked list is still a much better solution than trying to use
- Ma Alloc, or Reserve as work for this purpose.
-
- >
- > Where I can find the MakeLib extension?
-
- It is on nic.funet.fi in the /systems/amiga/programming/amos directory.
- Don't ask me why when there is an aminet mirror at the same site!
-
-
- +-------------------------+------------------------------------+
- | | _____ |
- | PAUL HICKMAN | / \ ON A HOT SUMMER NIGHT |
- | (ph@doc.ic.ac.uk) | / O O \ WOULD YOU OFFER YOUR |
- | DEPARTMENT OF COMPUTING | | _ | THROAT TO THE WOLF |
- | IMPERIAL COLLEGE LONDON | \ / \ / WITH THE RED ROSES ? |
- | | \_____/ |
- +-------------------------+------------------------------------+
- Machines: Amiga 500 WB1.3 - 1mb Memory - External Disk Drive.
- Amiga 1200 WB3.0 - 6mb Memory - 200Mb Hard Disk.
-
-
-